import { defineStore } from "pinia";
import { createPinia } from "pinia";
import { createPersistedState } from "pinia-plugin-persistedstate";

export const useSystemConfig = defineStore("systemConfig", {
  state: () => ({
    primaryColor: "#1890ff",
    theme: "fixed",
    layout: "vertical",
    siderDarkColor: "rgb(30,30,30)",
    borderRadius: 6,
    menuCollapsed: false,
    showTabs: true,
    customTheme: {
      theme: "light",
      siderColor: "",
      colorBgBase: "",
      colorBgContainer: "",
    },
    routerTransition: "fade",
    availableLayouts: ["sideMenu", "topMenu", "grid"],
    showDrawer: false,
    menuWidth: 200,
    headerHeight: 64,
  }),
  actions: {
    setTheme(theme) {
      this.theme = theme;
    },
    setLayout(layout) {
      this.layout = layout;
    },
  },
  persist: true,
});
const pinia = createPinia();
pinia.use(createPersistedState());
export default pinia;
